package com.cljz.makepassenger.widget;

import android.app.Activity;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;

import com.cljz.makepassenger.R;

/**
 * Created by Administrator on 2017/4/7 0007.
 */

public class SettingNotifyDialog extends Dialog {
    private Context context;
    private Activity activity;
    private String flag;
    TextView mTxtHint;
    TextView mTxtCancle;
    public TextView mTxtDialogExit;

    public SettingNotifyDialog(Context context, Activity activity, int themeResId, String flag) {
        super(context, themeResId);
        this.context = context;
        this.activity = activity;
        this.flag = flag;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_exit_view);
        //设置弹出对话框的高度和位置
        this.getWindow().setGravity(Gravity.BOTTOM);
        WindowManager.LayoutParams params = this.getWindow().getAttributes();//得到这个dialog界面的参数对象
        params.width = activity.getWindowManager().getDefaultDisplay().getWidth() - 40;////得到当前显示设备的宽度，单位是像素
        //动态设置全屏，退出全屏
        this.getWindow().setAttributes(params);
        mTxtHint = (TextView) findViewById(R.id.txt_hint);
        mTxtCancle = (TextView) findViewById(R.id.txt_cancel);
        mTxtDialogExit = (TextView) findViewById(R.id.txt_dialog_exit);
        if (flag.equals("MessageSettingActivity")) {
            mTxtHint.setText("关闭后将不能及时收到邀请消息");
            mTxtDialogExit.setText("不再接收消息通知");
        }
        mTxtCancle.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                SettingNotifyDialog.this.dismiss();
            }
        });
    }
}
